/**
 * @program: LeetCode
 * @description: LeetCode : 300. 最长递增子序列
 * @author: WXY
 * @create: 2023-01-29 15:25
 * @Version 1.0
 **/
public class Num300_lengthOfLIS {
    public static int lengthOfLIS(int[] nums) {
        //dp[i]表示i之前包括i的以nums[i]结尾的最长递增子序列的长度
        int[] dp = new int[nums.length];
        for (int i = 0; i < nums.length; i++) {
            dp[i] = 1;
        }
        int max = 1;
        for (int i = 1; i < nums.length; i++) {
            for (int j = 0; j < i; j++) {
                if (nums[i] > nums[j]) {
                    dp[i] = Math.max(dp[i], dp[j] + 1);
                }
            }
            max = Math.max(dp[i], max);
        }
        return max;
    }

    public static void main(String[] args) {
        int[] arr = {4,10,4,3,8,9};
        int i = lengthOfLIS(arr);
        System.out.println(i);
    }
}
